﻿using System;
using System.Collections.Generic;
using System.Text;
using ArcEngine;
using ArcEngine.Resources;
using System.Drawing;
using ArcEngine.Graphics;


namespace DungeonEye
{
	/// <summary>
	/// Represents a player in the team
	/// </summary>
	public class Hero
	{

		public Hero(string name)
		{
			Name = name;

			// Load tiles
			HeroesTiles = ResourceManager.GetTileSet("Heroes");
			HeroesTiles.Zoom = new SizeF(2.0f, 2.0f);
		}

		/// <summary>
		/// Generate a new hero with random values
		/// <see cref="http://www.aidedd.org/regles-f97/creation-de-perso-t1456.html"/>
		/// <see cref="http://christiansarda.free.fr/anc_jeux/eob1_intro.html"/>
		/// </summary>
		public void Generate()
		{
			strength = ResourceManager.Random.Next(9, 17);
			intelligence = ResourceManager.Random.Next(4, 17);
			wisdom = ResourceManager.Random.Next(4, 17);
			dexterity = ResourceManager.Random.Next(4, 17);
			constitution = ResourceManager.Random.Next(4, 17);
			charisma = ResourceManager.Random.Next(3, 18);
			armorClass = ResourceManager.Random.Next(0, 10);
			maxHP = ResourceManager.Random.Next(6, 37);
			hp = maxHP;
			level = 3;

			TileID = ResourceManager.Random.Next(0, 32);
		}



		/// <summary>
		/// Draw the head of the hero
		/// </summary>
		/// <param name="pos"></param>
		public void DrawHead(Point pos)
		{
			HeroesTiles.Bind();
			HeroesTiles.Draw(TileID, pos);
		}


		#region Heroe properties


		/// <summary>
		///  Name of the hero
		/// </summary>
		public string Name;


		/// <summary>
		/// 
		/// </summary>
		public int hp;


		/// <summary>
		/// 
		/// </summary>
		public int maxHP;


		/// <summary>
		/// 
		/// </summary>
		public int strength;

		/// <summary>
		/// 
		/// </summary>
		public int maxStrenght;



		/// <summary>
		/// 
		/// </summary>
		public int intelligence;


		/// <summary>
		/// 
		/// </summary>
		public int wisdom;


		/// <summary>
		/// 
		/// </summary>
		public int dexterity;


		/// <summary>
		/// 
		/// </summary>
		public int constitution;


		/// <summary>
		/// 
		/// </summary>
		public int charisma;


		/// <summary>
		/// 
		/// </summary>
		public int armorClass;


		/// <summary>
		/// 
		/// </summary>
		public int level;


		/// <summary>
		/// 
		/// </summary>
		public HeroAlignment alignment;


		/// <summary>
		/// 
		/// </summary>
		public HeroClass Class;


		/// <summary>
		/// 
		/// </summary>
		public HeroRace race;

		/// <summary>
		/// 
		/// </summary>
		public HeroProfession profession;

		/// <summary>
		/// ID of head tile
		/// </summary>
		public int TileID;

		/// <summary>
		/// Number of arrows in the quiver
		/// </summary>
		public int Arrows;

		#endregion



		#region Properties


		/// <summary>
		/// Tileset of the heroes
		/// </summary>
		TileSet HeroesTiles;



		#endregion
	}


	/// <summary>
	/// 
	/// </summary>
	public enum HeroAlignment
	{
		LawfulGood,
		NeutralGood,
		ChaoticGood,
		LawfulNeutral,
		TrueNeutral,
		ChoaticNeutral,
		LawfulEvil,
		NeutralEvil,
		ChaoticEvil
	}

	/// <summary>
	/// 
	/// </summary>
	public enum HeroClass
	{
		Fighter,
		Ranger,
		Paladin,
		Mage,
		Cleric,
		Thief
	}


	/// <summary>
	/// 
	/// </summary>
	public enum HeroRace
	{
		HumanMale,
		HumanFemale,
		ElfMale,
		ElfFemale,
		HalfElfMale,
		HalfElfFemale,
		DwarfMale,
		DwarfFemale,
		GnomeMale,
		GnomeFemale,
		HalflingMale,
		HalflingFemale
	}


	/// <summary>
	/// 
	/// </summary>
	[Flags]
	public enum HeroProfession
	{
		Fighter,
		Ranger,
		Paladin,
		Mage,
		Cleric,
		Thief
	}
}
